﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SwenAssigment.Classes
{
    public class Month
    {
        private int MonthNo;
        private String MonthName;
        private List<Day> Days;
        private int TotalNumberOfRoom;
        public Month(int MonthNo, int TotalNumberOfRoom, List<Day> Days)
        {
            this.MonthNo = MonthNo;
            this.TotalNumberOfRoom = TotalNumberOfRoom;
            this.Days = Days;
            if (MonthNo == 1)
            {
                MonthName = "January";
            }
            else if (MonthNo == 2)
            {
                MonthName = "February";
            }
            else if (MonthNo == 3)
            {
                MonthName = "March";
            }
            else if (MonthNo == 4)
            {
                MonthName = "April";
            }
            else if (MonthNo == 5)
            {
                MonthName = "May";
            }
            else if (MonthNo == 6)
            {
                MonthName = "June";
            }
            else if (MonthNo == 7)
            {
                MonthName = "July";
            }
            else if (MonthNo == 8)
            {
                MonthName = "August";
            }
            else if (MonthNo == 9)
            {
                MonthName = "September";
            }
            else if (MonthNo == 10)
            {
                MonthName = "October";
            }
            else if (MonthNo == 11)
            {
                MonthName = "November";
            }
            else
            {
                MonthName = "December";
            }
        }
        public String getMonthName()
        {
            return MonthName;
        }
        public List<Day> getDays()
        {
            return Days;
        }
        public Decimal GetStatics()
        {
            Decimal Total = 0;
            foreach (Day day in Days)
            {
                Total += day.getORoom();
            }
            try
            {
                Total = ((Decimal)(Total / (TotalNumberOfRoom * Days.Count))) * 100;
            }
            catch (Exception ex)
            {
                Total = 0;
            }

            return Total;
        }
    }

}